package com.ruoyi.business.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.domain.model.CheckDegreeHis;
import com.ruoyi.business.domain.model.NoCheckDegreeDormitory;
import com.ruoyi.business.domain.model.useDegreesSumEntity;
import com.ruoyi.business.mapper.BedsPlusMapper;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.domain.bo.DegreesBo;
import com.ruoyi.business.domain.vo.DegreesVo;
import com.ruoyi.business.domain.Degrees;
import com.ruoyi.business.mapper.DegreesMapper;
import com.ruoyi.business.service.IDegreesService;

import java.util.List;
import java.util.Map;
import java.util.Collection;

/**
 * 宿舍电度数Service业务层处理
 *
 * @author ruoyi
 * @date 2023-06-28
 */
@RequiredArgsConstructor
@Service
public class DegreesServiceImpl  extends ServiceImpl<DegreesMapper, Degrees> implements IDegreesService {
    @Autowired
    private DegreesMapper degreesMapper;
    @Override
    public LambdaQueryWrapper<Degrees> buildQueryWrapper(Degrees bo) {
        LambdaQueryWrapper<Degrees> lqw = Wrappers.lambdaQuery();
        lqw.eq(bo.getDormitoryid() != null, Degrees::getDormitoryid, bo.getDormitoryid());
        lqw.eq(bo.getReadDate() != null, Degrees::getReadDate, bo.getReadDate());
        lqw.eq(bo.getNumberdegrees() != null, Degrees::getNumberdegrees, bo.getNumberdegrees());
        return lqw;
    }

    @Override
    public List<Degrees> getList(Degrees entity) {
        return degreesMapper.getList(entity);
    }

    @Override
    public List<useDegreesSumEntity> useDegreesSum(Integer year) {
        return degreesMapper.useDegreesSum(year);
    }

    @Override
    public List<NoCheckDegreeDormitory> getNoCheckDegreeDormitory(String readdate) {
        return degreesMapper.getNoCheckDegreeDormitory(readdate);
    }

    @Override
    public List<CheckDegreeHis> getHisList(String buildingname) {
        return degreesMapper.getHisList(buildingname);
    }

    @Override
    public void del(Long id) {
        degreesMapper.del(id);
    }
}
